#include "CCamera.h"
CCamera CCamera::Camera;

CCamera::CCamera()
{
    cX = 800;
    cY = 600;
    cZ = 0;

}

CCamera::~CCamera()
{
    //dtor
}

void CCamera::Translate()
{
    glTranslatef(-cX,-cY,cZ);
}

void CCamera::CenterCamera(GLfloat x, GLfloat y)
{
    this->cX = x - (WIDTH / 2);
    this->cY = x - (HEIGHT / 2);
}

void CCamera::ZoomCamera(GLfloat x, GLfloat y, GLfloat z)
{
    this->cX = x;
    this->cY = y;
    if (this->cZ < z)
    {
        for (cZ; cZ >= z; this->cZ++)
        {
            //glTranslatef(this->cX,this->cY,this->cZ);
            Translate();
        }
    }
    if (this->cZ > z)
    {
        for (cZ; cZ <= z; this->cZ--)
        {
            //glTranslatef(this->cX,this->cY,this->cZ);
            Translate();
        }
    }
}

void CCamera::SetCamera(GLfloat x, GLfloat y)
{
    this->cX = x;
    this->cY = y;
}
